package com.sogeti.mentormatch.event
{
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import flash.events.Event;

	/**
	 * The LoginEvent class is the class we use to dispatch an event that is specific to the user action
	 * where they click the login button on the login panel. 
	 * 
	 * Basically events are the "buckets" we use to attach useful data that the backend is going to need. 
	 * Rather than attach the values for username and password to the model, and execute the commands and
	 * get the values from there, or simply to have remote object declarations all over the app, we attach
	 * useful relevant data to events, then dispatch them to the controller.
	 * 
	 * The controller then sends the event to the command, which takes the data off the event and sends it
	 * to the backend. 
	 * 
	 * We use these custom events to give our user interactions specific literal names with an intrinsic value.
	 * Rather than simply dealing with clicks, mouse overs etc, now we are handling events with strong names
	 * that have a relevant meaning to the developer. 
	 */
	public class LoginEvent extends CairngormEvent
	{
		/**
		 * This is the "TYPE" of the event.
		 */ 
		public static const EVENT_LOGIN : String = "doLogin";
		
		public var loginName:String;
		public var password:String;
		
		public function LoginEvent(type:String)
		{
			super(type, bubbles, cancelable);
		}
		
		/**
     	 * Override the inherited clone() method, but don't return any state.
     	 */
		override public function clone() : Event
		{
			return new LoginEvent( type );
		}
		
	}
}